<template>
	<view class="home-page">
		<u-navbar leftIconColor="#000" :autoBack="true" :placeholder="true" bgColor="rgba(255,255,255,0.0)">
			<view slot="center" class="nav-title">
				公告列表
			</view>
		</u-navbar>
		<view class="list-item" v-for="(item,index) in textList" :key="index" @click="godetails(item.id)">
			<view class="item-info">
				<image src="../../../static/home/noc-icon.png" mode=""></image>
				<view>
					<view class="info-top">
						<view class="info-title">
							{{item.title}}
						</view>
					</view>
					<view class="info-text">
						{{item.description}}
					</view>
				</view>
			</view>
			<view class="item-bottom">
				<view>
					{{item.time}}
				</view>
				<image src="../../../static/home/red-right.png" mode="heightFix"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				textList: []
			}
		},
		onLoad() {
			this.postnotice()
		},
		methods: {
			postnotice() {
				this.$Request({
					method: 'POST',
					url: '/api/index/indexNoticeList',
					data: {},
					ismsg: false,
				}).then(res => {
					if (res.code == 1) {
						this.textList = res.data
					}
				})
			},
			godetails(id) {
				uni.navigateTo({
					url: '/pages/index/notice/details?id=' + id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.home-page {
		background-image: url('../../../static/home/home-bg.png');
		background-repeat: no-repeat;
		background-size: 100% 500rpx;
		min-height: 80vh;
		padding: 30rpx;

		.nav-title {
			color: #000;
		}

		.list-item {
			background-color: #fff;
			border-radius: 30rpx;
			padding: 30rpx;
			margin-bottom: 30rpx;
			box-shadow: 0rpx 3rpx 32rpx 1rpx rgba(0, 0, 0, 0.08);

			.item-info {
				padding-bottom: 20rpx;
				border-bottom: 1rpx solid #F6F6F6;
				display: flex;
				align-items: center;
				image{
					width: 50px;
					height: 50px;
				}
				.info-top {
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin-left: 15rpx;
					.info-title {
						font-size: 32rpx;
						color: #333;
						font-weight: bold;
						text-overflow: ellipsis;
						overflow: hidden;
						white-space: nowrap;
					}


				}

				.info-text {
					margin-left: 15rpx;
					margin-top: 10rpx;
					font-size: 26rpx;
					color: #999;
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
				}
			}

			.item-bottom {
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-size: 24rpx;
				color: #999;
				margin-top: 20rpx;

				image {
					width: 32rpx;
					height: 32rpx;
				}
			}
		}
	}
</style>